import java.util.Scanner;

/**
 * @Title: 数组元素的目标和
 * @Author 贾金博
 * @Package PACKAGE_NAME
 * @Date 2024/3/3 21:08
 * @description: 双指针
 */
public class 数组元素的目标和 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int[] a = new int[n + 10];
        for(int i = 1; i <= n; ++ i ) {
            a[i] = sc.nextInt();
        }
        int[] b = new int[m + 10];
        for(int j = 1; j <= m; ++ j ) {
            b[j] = sc.nextInt();
        }

        for(int i = 1; i <= n; ++ i ) {
            int j = m;
            while(a[i] + b[j] > x)j--;
            if(a[i] + b[j] == x) {
                System.out.println((i - 1) + " " + ( j - 1)); // 注意 下标是从1开始的
                return;
            }
        }
    }
}
